
<?php
include_once 'common/AdminTop.php';
include_once '../Class/DB.php';
include_once '../Class/User.php';
$userName=$_POST["name"];
if($userName!="admin")
{
	?>
	<script language="JavaScript">
	alert("You are not administrator.");
	window.location.href="index.php";
	</script>	
	<?php
	exit();
}
$password=$_POST["password"];
$db=new DB();
$_SESSION["AdminPassed"]=$db->Verify($userName, $password);
if($_SESSION["AdminPassed"])
{
	$_SESSION["Admin"]=$db->get_userName_info($userName);
}
else 
{
	?>
<script language="JavaScript">
alert("wrong password.");
</script>
<?php 
}
?>
<script language="JavaScript">
window.location.href="index.php";
</script>
<?php 
//header("Location:index.php");
include_once 'common/AdminTop.php';
exit();
?>